package com.donger.business.upms.controller;


import com.donger.business.upms.query.CommonQuery;
import com.donger.business.upms.service.impl.CommonService;
import com.donger.common.core.utils.Res;
import com.donger.common.core.utils.Result;
import com.donger.common.data.entity.DropDown;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@AllArgsConstructor
@Api(tags = "通用服务API")
public class CommonController{
    private final CommonService commonService;

    @GetMapping("/common/dropdown")
    @ApiOperation(value = "提供下拉列表通用接口")
    public Result<List<DropDown>> dropdown(CommonQuery commonQuery){
        List<DropDown> dropDowns = commonService.queryTableDropdown(commonQuery.getTableName(), commonQuery.getValueName(), commonQuery.getLabelName());
        return Res.ok(dropDowns);
    }


}
